import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {clearStorage, getUserInfo, UserInfo} from '@utils/auth';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.less'],
})
export class HomeComponent implements OnInit {
  history = {};
  userInfo?: UserInfo;

  constructor(private router: Router) {
  }

  getHistory(data): void {
    this.history = data;
  }

  ngOnInit(): void {
    this.userInfo = getUserInfo();
  }

  logout(): void {
    clearStorage();
    this.router.navigateByUrl('/login');
  }
}
